<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>成绩管理</title>
<style type="text/css">
body,td,th {
	font-size: 12px;
}
.table1 {
	border-top:#000 1px solid;
	border-right:#000 1px solid;
}
.table1 td {
	border-bottom:#000 1px solid;
	border-left:#000 1px solid;
	padding:3px 4px 3px 4px;

}
</style>
</head>
<body>
<?php
$realname=$_GET['realname'];
$conn=mysql_connect('127.0.0.1','betty','123qwe');
mysql_query("SET NAMES 'utf8'",$conn);
mysql_select_db('betty',$conn);
$delid=intval($_GET['delid']);
if($delid){
	$sql1="DELETE FROM `scord` WHERE `id`='{$_GET['delid']}'";
	$ret=mysql_query($sql1,$conn);
	if($ret){
		echo '删除成功';
	}else{
		echo '删除失败';
0	}
}
?>
<form id="form1" name="form1" method="get" action="">
<table width="600" border="0" cellpadding="0" cellspacing="0" class="table1">
  <tr>
    <td>姓名
        <input type="text" name="realname" id="realname" value="<?php echo $realname;?>" />
        <input type="submit" name="button" id="button" value="提交" />
    </td>
  </tr>
</table>
</form>
<table width="500" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="5"></td>
  </tr>
</table>
<table width="600" border="0" cellpadding="0" cellspacing="0" class="table1">
  <tr align="center">
    <td>选择</td>
    <td>ID</td>
    <td>姓名</td>
    <td>性别</td>
    <td>得分</td>
    <td>操作</td>
  </tr>
<?php
$sql2="SElECT * FROM `scord` WHERE realname LIKE '%{$realname}%'";
$return=mysql_query($sql2,$conn);
while($row=mysql_fetch_array($return,MYSQL_ASSOC)){
?>
  <tr align="center">
    <td><input type="checkbox" name="checkbox" id="checkbox" /></td>
    <td><?php echo $row['id'];?></td>
    <td><?php echo $row['realname'];?></td>
    <td><?php
if($row['gender']=='1'){
	echo '男';
}else if($row['gender']=='2'){
 	echo '女';
}else{
	echo '未知('.$row['gender'].')';
}
	?></td>
    <td><?php echo $row['point'];?></td>
    <td><a href="scord-edit.php?id=<?php echo $row['id'];?>">编辑</a>&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="?delid=<?php echo $row['id'];?>">删除</a><br /></td>
  </tr>
<?php
}
?>
</table>
</body>
</html>
